package com.gph.saviorframework.es.core.geo;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.geo.Point;

@Getter
@Setter
public class GeoPoint {

	private double lat;//维度
	private double lon;//经度

	private GeoPoint() {
		//required by mapper to instantiate object
	}

	public GeoPoint(double latitude, double longitude) {
		this.lat = latitude;
		this.lon = longitude;
	}

	public static GeoPoint fromPoint(Point point) {
		return new GeoPoint(point.getX(), point.getY());
	}

	public static Point toPoint(GeoPoint point) {
		return new Point(point.getLat(), point.getLon());
	}
}


